﻿<%@ Page Language="VB" AutoEventWireup="true" CodeFile="ticket.aspx.vb" Inherits="ticket" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  Private Shared Function IsNumeric(inputString As String) As Boolean
	Return System.Text.RegularExpressions.Regex.IsMatch(inputString, "^[0-9]+$")
End Function
Public Sub price(seder As [Object], e As EventArgs)
	Dim totalamount As Double = 0
	Dim totalticket As Double = 0
	Dim count As Integer = 0
	Dim count1 As Integer = 0
	Dim numbers As Integer() = New Integer(4) {}
	Dim quantity As Integer() = New Integer(4) {}

	Dim num As Boolean = False



	For Each gvr As GridViewRow In GridView3.Rows
		Dim tb As TextBox = DirectCast(gvr.FindControl("TextBox1"), TextBox)

		If tb.Text <> "" Then
			num = True
			Label55.Text = ""

			If IsNumeric(tb.Text) = True Then



				If (Integer.Parse(tb.Text) > 0) Then
					Label55.Text = ""

					Dim tb2 As Label = DirectCast(gvr.FindControl("Label9"), Label)
					Dim tb3 As Label = DirectCast(gvr.FindControl("Label12"), Label)
					numbers(count) = Integer.Parse(tb.Text)

					Dim price As Double = Double.Parse(tb3.Text)
					Dim quan As Double = Double.Parse(tb.Text)
					Dim amount As Double = price * quan
					tb2.Text = String.Format("{0:c}", amount)
					totalticket = totalticket + quan
					totalamount = totalamount + amount
					Label10.Text = String.Format("{0:c}", totalamount)
					Label11.Text = totalticket.ToString()
					Label38.Text = Request.QueryString("cinema")
					count = count + 1

					Button1.CommandName = "NextView"
				Else

					Label55.Text = "incorrect >0"

					Label55.Text = "*Quantity must larger than zero"

					Button1.CommandName = ""
				End If
			Else
				Label55.Text = "*Quantity must be a digit"

				Button1.CommandName = ""
				Dim tb6 As Label = DirectCast(gvr.FindControl("Label9"), Label)
				tb6.Text = ""
				Label10.Text = ""
				Label11.Text = ""
			End If

			If num <> True Then
				Label55.Text = "*Quantity can not be empty"
				Dim tb7 As Label = DirectCast(gvr.FindControl("Label9"), Label)
				tb7.Text = ""
				Label10.Text = ""
				Label11.Text = ""


				Button1.CommandName = ""

			End If
		End If

		If num <> True Then
			Label55.Text = "*Quantity can not be empty"
			Dim tb8 As Label = DirectCast(gvr.FindControl("Label9"), Label)
			tb8.Text = ""
			Label10.Text = ""
			Label11.Text = ""


			Button1.CommandName = ""



		End If
	Next


	Label40.Text = numbers(0).ToString()
	Label42.Text = numbers(1).ToString()
	Label44.Text = numbers(2).ToString()
	Label46.Text = numbers(3).ToString()
	Label48.Text = numbers(4).ToString()
End Sub

Protected Sub checkquantity(seder As [Object], e As EventArgs)
	For Each gvr As GridViewRow In GridView3.Rows
		Dim tb As TextBox = DirectCast(gvr.FindControl("TextBox1"), TextBox)

		If IsNumeric(tb.Text) = True Then
			Label55.Text = "*Quantity must be digit"

		ElseIf tb.Text = "" Then
			Label55.Text = "*Quantity can not be empty"
		ElseIf tb.Text <> "" Then
			Button1.CommandName = "NextView"

		End If
	Next
End Sub

Protected Sub result(sender As [Object], e As EventArgs)
	For Each gvr As GridViewRow In GridView2.Rows
		Dim tb As Label = DirectCast(gvr.FindControl("Label31"), Label)
		Dim tb2 As Label = DirectCast(gvr.FindControl("Label36"), Label)
		Dim tb3 As Label = DirectCast(gvr.FindControl("Label3"), Label)
		Dim tb4 As Label = DirectCast(gvr.FindControl("Label5"), Label)
		Label18.Text = tb.Text.ToString()
		Label23.Text = tb2.Text.ToString()
		Label25.Text = tb3.Text.ToString()
		Label30.Text = tb4.Text.ToString()
		Label35.Text = Label11.Text.ToString()
		Label33.Text = String.Format("{0:c}", Label10.Text)
		Label19.Text = txtcardtype.Text
		Label15.Text = nameoncard.Text
		Label26.Text = cardnum.Text
		Label28.Text = month.Text + "/" + yearcard.Text
		Label50.Text = DateTime.Today.ToString("d")


		Label52.Text = Request.QueryString("sessiontype")
	Next


End Sub
Protected Sub update(sender As Object, e As EventArgs)


	SqlDataSource3.InsertParameters("CustomerUserName").DefaultValue = Page.User.Identity.Name

	SqlDataSource3.InsertParameters("orderdate").DefaultValue = Label50.Text
	SqlDataSource3.InsertParameters("title").DefaultValue = Label18.Text
	SqlDataSource3.InsertParameters("theatre").DefaultValue = Label23.Text
	SqlDataSource3.InsertParameters("cinema").DefaultValue = Label38.Text
	SqlDataSource3.InsertParameters("sessiondate").DefaultValue = Label25.Text

	SqlDataSource3.InsertParameters("numsenior").DefaultValue = Label44.Text
	SqlDataSource3.InsertParameters("sessiontime").DefaultValue = Label30.Text
	SqlDataSource3.InsertParameters("numadult").DefaultValue = Label40.Text
	SqlDataSource3.InsertParameters("numchild").DefaultValue = Label42.Text
	SqlDataSource3.InsertParameters("AmountPaid").DefaultValue = Label33.Text
	SqlDataSource3.InsertParameters("totalticket").DefaultValue = Label35.Text
	SqlDataSource3.InsertParameters("numpensioner").DefaultValue = Label48.Text
	SqlDataSource3.InsertParameters("numstudent").DefaultValue = Label46.Text
	SqlDataSource3.InsertParameters("cardnumber").DefaultValue = Label26.Text
	SqlDataSource3.InsertParameters("namecard").DefaultValue = Label15.Text
	SqlDataSource3.InsertParameters("creditcardtype").DefaultValue = Label19.Text
	SqlDataSource3.InsertParameters("tickettype").DefaultValue = Label52.Text
	SqlDataSource3.InsertParameters("expiredate").DefaultValue = Label28.Text
	SqlDataSource3.InsertParameters("orderdate").DefaultValue = Label50.Text


	SqlDataSource3.Insert()
	Dim connectionString As String = WebConfigurationManager.ConnectionStrings("connectionstring").ConnectionString
	Dim con As New SqlConnection(connectionString)
	Dim cmd As New SqlCommand("SELECT ticketsold from datesession  WHERE sessionid=@session", con)
	cmd.Parameters.AddWithValue("@session", Request.QueryString("session"))
	Using con
		con.Open()
		Dim result As [Object] = cmd.ExecuteScalar()
		If result IsNot Nothing Then
			Label54.Text = [String].Format("{0:c}", result)

		End If
	End Using
	Dim sold As Integer
	sold = Integer.Parse(Label54.Text) + 1
	SqlDataSource5.UpdateParameters("ticketsold").DefaultValue = sold.ToString()
	SqlDataSource5.UpdateParameters("sessionid").DefaultValue = Request.QueryString("session")
	SqlDataSource5.UpdateParameters("date").DefaultValue = Label25.Text
	SqlDataSource5.Update()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
 <script type="text/javascript">
        
        function displayCalendar()
        {
            var datePicker = document.getElementById('datePicker');
            datePicker.style.display = 'block';
        }
    
    </script>

    
<script type="text/javascript">


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}




</script>
 <style type="text/css">
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
           
        }
    
    </style>
<style type="text/css">
html
{
  background-image:url('image/back.jpg'); 

    padding:10px;
    color:White;    
  
}
.content
{
    width:950px;
    margin:auto;
        height: 197px;
    }
a
{
 color: white;
 text-decoration:none;

}
a:hover
{
 color: red; 
  text-decoration:none;

}
.link
{
  margin-left:350px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link2
{
  margin-left:50px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.join
{
   background-color:#0099FF;
  clip:auto;
  font-weight:bold;
  font-size:large;
}
.table2
{
 border-style:solid;
   border-color:Black;
   background-color:White;
   color:Black;  
   width:900px; 
}
.row
{
   background-color:Gray;
   color:White;
}
.ticket
{
   background-color:#CC0000;
color:White;

}

.ticket:hover
{
 color: black; 
  text-decoration:none;


}
    .style1
    {
        width: 509px;
    }
    
.footer
{

     font-weight:bold;
  font-size:large;  

}
.ticket1
{
    padding-left:200px;
}
.view2
{
 padding-left:180px;  
}
.text
{
 font-weight:bold;
}
</style>
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content">
  <asp:Image ID="Image1" Width="1000" Height="130" ImageUrl="~/image/tdk-jun5-bannerbatmanexclusivo2.jpg" runat="server" />
<asp:HyperLink ID="HyperLink14"  CssClass="link" NavigateUrl="~/Default.aspx" runat="server">Home</asp:HyperLink>
<asp:HyperLink ID="HyperLink1"  CssClass="link2" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink> <asp:HyperLink ID="HyperLink2" CssClass="link2" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" CssClass="link2"  NavigateUrl="~/Price.aspx" runat="server">Prices</asp:HyperLink>
<asp:HyperLink ID="HyperLink6" CssClass="link2"  NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink>
 <br /> <br />
      
      
<table >
 <tr><td>Buy Tickets For:  </td> <td>  <asp:Menu
        id="menuTabs"
      StaticMenuItemStyle-BackColor="#333333" 
        StaticMenuItemStyle-Font-Size="Larger"
       DynamicHorizontalOffset="0"   
      DynamicHoverStyle-BackColor="#666666"
        DynamicMenuItemStyle-Width="150px"
       DynamicMenuItemStyle-BackColor="#333333" runat="server">
       <Items>
       <asp:MenuItem
       Text="Cinemas" Selectable="False"  >
     <asp:MenuItem
       Text="Southwestcinema4"
   
        NavigateUrl="~/MovieCinema1.aspx" />
    <asp:MenuItem
      Text="RuralTwinCinemas"
     NavigateUrl="~/MovieCinema2.aspx" />
   </asp:MenuItem>
       </Items>
       </asp:Menu></td><td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp</td><td> <asp:Label ID="Label4" runat="server" Text="Label"></asp:Label></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp 
    <asp:Label ID="Label5" runat="server" Text="UserName" Font-Bold="True"></asp:Label>    <asp:LoginName ID="LoginName1" runat="server" /> &nbsp;&nbsp;&nbsp
    <asp:LoginStatus ID="LoginStatus1" runat="server" />
    
    </td>
<td></td>
</tr>
  </table>
   <br />
        <asp:Label ID="Label54" runat="server" ></asp:Label>
<asp:MultiView ID="MultiView1"  ActiveViewIndex="0" runat="server">
<asp:View ID="view1" runat="server">
<div class="ticket1">
<table border="1" cellpadding="10"  cellspacing="0"  style="background-color: #FFFFFF; color: #000000; background-attachment: inherit;">
<tr><th style="background-color: #CCCCCC">The movies you choose</th><th>Please select your ticket quantities</th></tr>
<tr><td style="background-color: #CCCCCC">
 <asp:GridView ID="GridView1" AutoGenerateColumns="False"   BorderStyle="None" HeaderStyle-BorderStyle="None" 
        DataSourceID="SqlDataSource1" runat="server">
<Columns>
<asp:TemplateField ItemStyle-BorderStyle="None" HeaderStyle-BorderStyle="None">
<ItemTemplate>
 <asp:Label ID="Label1" runat="server" Text="Movie: " Font-Bold="True"></asp:Label><%#Eval("MovieTitle") %><br />
    <asp:Image ID="Image1" runat="server" Width="172" Height="250" ImageUrl=  '<%# "Movie/" + Eval("imagefname")%>'/><br /> <br />
 
</ItemTemplate>
    <HeaderStyle BorderStyle="None" />
    <ItemStyle BorderStyle="None" />
</asp:TemplateField>
</Columns>
     <HeaderStyle BorderStyle="None" />
    </asp:GridView>
</td>
<td> <asp:GridView ID="GridView2" AutoGenerateColumns="False" BorderStyle="None" HeaderStyle-BorderStyle="None" 
        DataSourceID="SqlDataSource1" runat="server">
<Columns>
<asp:TemplateField ItemStyle-BorderStyle="None" HeaderStyle-BorderStyle="None">
<ItemTemplate>
 <asp:Label ID="Label1" runat="server" Text="Movie: " Font-Bold="True"></asp:Label><asp:Label
     ID="Label31" runat="server" Text='<%#Eval("MovieTitle") %>'></asp:Label>
 <br />
 <asp:Label ID="Label15" runat="server" Text="Theatre Name: " Font-Bold="True"></asp:Label><asp:Label
     ID="Label36" runat="server" Text='<%#Eval("TheatreName") %>'></asp:Label><br />
  <asp:Label ID="Label16" runat="server" Text="Address: " Font-Bold="True"></asp:Label><%#Eval("Theatreaddress") %><br />
 <asp:Label ID="Label2" runat="server" Text="Session Time" Font-Underline="True"></asp:Label><br />
    <asp:Label ID="Label6" runat="server" Text="Date: " Font-Bold="True"></asp:Label>  <asp:Label ID="Label3" runat="server" Text='<%# Eval("date","{0:D}") %>'></asp:Label><br />
   <asp:Label ID="Label7" runat="server" Text="Time: " Font-Bold="True"></asp:Label><asp:Label ID="Label5" runat="server" Text='<%# Eval("time") %>' ></asp:Label><br />
</ItemTemplate>
    <HeaderStyle BorderStyle="None" />
    <ItemStyle BorderStyle="None" />
</asp:TemplateField>
</Columns>
    <HeaderStyle BorderStyle="None" />
    </asp:GridView>
  
    <hr />
  <asp:GridView ID="GridView3"    DataSourceID="SqlDataSource2" AutoGenerateColumns="false" runat="server">
 <Columns>
 <asp:TemplateField>
 <HeaderTemplate>
 <tr><th>Type</th><th>Quantity</th><th>Price</th><td>Total</td></tr>
 </HeaderTemplate>
 <ItemTemplate>

<tr><td style="text-decoration: underline"><%#Eval("TicketType")%></td><td><asp:TextBox   ID="TextBox1"  Width="30"   EnableTheming="false" runat="server" ></asp:TextBox></td><td>
    <asp:Label ID="Label8" runat="server"  Text='<%#  Eval("Price","{0:c}") %>'></asp:Label></td><td> 
 <asp:Label ID="Label9" runat="server" ></asp:Label></td></tr>
   <asp:Label ID="Label12" runat="server" Visible="false" Text='<%#  Eval("Price") %>'></asp:Label>
 
 </ItemTemplate>
 </asp:TemplateField> 
 </Columns>  
    </asp:GridView>
    <hr />
    <asp:Label ID="Label55" runat="server" ForeColor="#CC0000"></asp:Label> <br />
    <asp:Button ID="Button2" runat="server" Text="Calculate Total" OnClick="price" /><br />
 <asp:Label ID="Label13" runat="server" Text="Your Total Transactions Cost: " Font-Bold="True"></asp:Label>  <asp:Label ID="Label10" runat="server" ></asp:Label><br />
 <asp:Label ID="Label14" runat="server" Text="Number of Tickets: " Font-Bold="True"></asp:Label>
  <asp:Label ID="Label11" runat="server"></asp:Label><br /><br />
  
 <asp:Button ID="Button1" Text="Continue"  OnClick="price"  runat="server" />  
  </td></tr>
  
 </table>
    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        
        
        
        SelectCommand="SELECT Movie.MovieTitle, Movie.imagefname, datesession.movieid, session2.time, datesession.date, Theatre.TheatreName, Theatre.TheatreAddress FROM Movie INNER JOIN datesession ON Movie.MovieId = datesession.movieid INNER JOIN session2 ON datesession.sessionid = session2.sessionid INNER JOIN Theatre ON Movie.TheatreId = Theatre.TheatreId WHERE (Movie.MovieId = @MovieId) AND (session2.sessionid = @session)">
        <SelectParameters>
            <asp:QueryStringParameter Name="MovieId" QueryStringField="movieid" 
                Type="Int16" />
            <asp:QueryStringParameter Name="session" QueryStringField="session" />
        </SelectParameters>

    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT [TicketType], [Price], [type] FROM [TicketPrices] WHERE ([cinema] = @cinema)AND ([type]=@sessiontype)">
        <SelectParameters>
            <asp:QueryStringParameter Name="cinema" QueryStringField="cinema" 
                Type="Int16" />
        </SelectParameters>
            <SelectParameters>
            <asp:QueryStringParameter Name="sessiontype" QueryStringField="sessiontype" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource> 
    </div>
</asp:View>
<asp:View ID="View2" runat="server">
          <div class="view2">
       <asp:Label ID="Label6" runat="server" Text="UserName: " CssClass="text"></asp:Label>

         <table border="1">
   <tr><td><asp:Label ID="cardtype" runat="server" Text="Credit Card Type:" CssClass="bold"></asp:Label></td>
      
  <td>  <asp:RadioButtonList ID="txtcardtype" runat="server">
 <asp:ListItem>Visa Card </asp:ListItem>
  <asp:ListItem>Master Card</asp:ListItem>
  <asp:ListItem>American Express</asp:ListItem>
 </asp:RadioButtonList>              
   <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Required" ControlToValidate="txtcardtype"></asp:RequiredFieldValidator>   </td></tr>            
 
     <tr><td> <asp:Label ID="namecard" runat="server" Text="Name On Card" CssClass="bold"></asp:Label>  </td>
            
     <td>     <asp:TextBox ID="nameoncard" runat="server"></asp:TextBox>      
  <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Required" ControlToValidate="nameoncard"></asp:RequiredFieldValidator>      </td></tr>                       
  
  
  <tr><td> <asp:Label ID="cardnumber" runat="server" text="Card Number" CssClass="bold"></asp:Label> </td>
    <td>     <asp:TextBox ID="cardnum" runat="server"></asp:TextBox>      
  <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="Required" ControlToValidate="cardnum"></asp:RequiredFieldValidator>                       
   <asp:CompareValidator ID="CompareValidator3" runat="server" ErrorMessage="(Invalid Card Number)" ControlToValidate="cardnum" Type="Integer" Operator="DataTypeCheck"></asp:CompareValidator> 
       <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ErrorMessage="16 digit number only" ControlToValidate="cardnum" ValidationExpression="^[0-9]{16}$" ></asp:RegularExpressionValidator>   </td></tr>

    
  <tr><td><asp:Label ID="Label16" runat="server" text="Card Expiry: Month" CssClass="bold"></asp:Label>  </td>
 <td> <asp:DropDownList
            ID="month" runat="server">
      <asp:ListItem Text="Month" Value="month"/>
        <asp:ListItem text="1" value="1" />  
        <asp:ListItem text="2" value="2" />  
        <asp:ListItem text="3" value="3" />  
        <asp:ListItem text="4" value="4" /> 
        <asp:ListItem text="5" value="5" /> 
         <asp:ListItem text="6" value="6" /> 
           <asp:ListItem text="7" value="7" /> 
          <asp:ListItem text="8" value="8" /> 
        <asp:ListItem text="9" value="9" /> 
         <asp:ListItem text="10" value="10" /> 
        <asp:ListItem text="11" value="11" /> 
             <asp:ListItem text="12" value="12" /> 
        </asp:DropDownList>  
 <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ErrorMessage="(required)" Text="(Required)" InitialValue="month" ControlTovalidate="month" runat="server"></asp:RequiredFieldValidator>
  <asp:Label ID="year" runat="server" Text="Year"></asp:Label> 
          <asp:TextBox ID="yearcard" runat="server"></asp:TextBox>             
          <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="Required"  Text="(Required)" ControlToValidate="yearcard"></asp:RequiredFieldValidator>       </td></tr>
           </table> 
         <asp:Button ID="Button4" Text="prev"   CommandName="PrevView" runat="server"  CssClass="button"/>
         <asp:Button ID="Button6" Text="next"  CommandName="NextView"    runat="server" />

        </table>
        </div>
               </asp:view>
<asp:View ID="view3"  OnActivate="result" runat="server">

 <table border="1">
 
<tr><td><asp:Label ID="Label8" runat="server" Text="UserName: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label9" runat="server"></asp:Label></td><td  rowspan="7"><table>
<tr><td><asp:Label ID="Label39" runat="server" Text="Total of Adult tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label40" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label41" runat="server" Text="Total of Children tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label42" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label43" runat="server" Text="Total of Senior tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label44" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label45" runat="server" Text="Total of Student tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label46" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label47" runat="server" Text="Total ofPensioner tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label48" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label34" runat="server" Text="Total Number of tickets: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label35" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label32" runat="server" Text="Total transaction cost: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label33" runat="server"></asp:Label>  </td></tr>
<tr><td><asp:Label ID="Label51" runat="server" Text="Ticket Type: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label52" runat="server"></asp:Label>  </td></tr>


 <tr><td><asp:Label ID="Label12" runat="server" Text="Credit cardType:"  CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label19" runat="server"></asp:Label> </tr>

 <tr><td> <asp:Label ID="Label20" runat="server" Text="name On Card:"  CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label15" runat="server"></asp:Label>  </td></tr>

  <tr><td>   <asp:Label ID="Label21" runat="server" Text="Card Number:"  CssClass="text"></asp:Label></td> 
<td><asp:Label ID="Label26" runat="server"></asp:Label></td></tr>

   <tr><td>  <asp:Label ID="Label27" runat="server" Text="Expirate Date:"  CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label28" runat="server"></asp:Label></td></tr>
</table> </td></tr>

<tr><td><asp:Label ID="Label49" runat="server" Text="Date Booked: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label50" runat="server"></asp:Label><asp:Label ID="Label53"  Visible="false" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label17" runat="server" Text="Movile Title: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label18" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label22" runat="server" Text="Theatre Name: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label23" runat="server"></asp:Label>  </td></tr>
<tr><td><asp:Label ID="Label37" runat="server" Text="Cinema: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label38" runat="server"></asp:Label>  </td></tr>

<tr><td><asp:Label ID="Label24" runat="server" Text="Session Date: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label25" runat="server"></asp:Label>  </td></tr>
<tr><td><asp:Label ID="Label29" runat="server" Text="Session Time: " CssClass="text"></asp:Label></td>
<td><asp:Label ID="Label30" runat="server"></asp:Label>  </td></tr>
</table>


    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [Order] WHERE [OrderId] = @OrderId" 
        InsertCommand="INSERT INTO [Order] ([CustomerUserName], [OrderDate], [title], [theatre], [cinema], [sessiondate], [sessiontime], [numadult], [numchild], [numsenior], [numstudent], [numpensioner], [totalticket], [AmountPaid], [tickettype], [creditcardtype], [namecard], [cardnumber], [expiredate]) VALUES (@CustomerUserName, @OrderDate, @title, @theatre, @cinema, @sessiondate, @sessiontime, @numadult, @numchild, @numsenior, @numstudent, @numpensioner, @totalticket, @AmountPaid, @tickettype, @creditcardtype, @namecard, @cardnumber, @expiredate)" 
        SelectCommand="SELECT [CustomerUserName], [OrderDate], [title], [theatre], [cinema], [sessiondate], [sessiontime], [numadult], [numchild], [numsenior], [numstudent], [numpensioner], [totalticket], [AmountPaid], [tickettype], [creditcardtype], [namecard], [cardnumber], [expiredate], [OrderId] FROM [Order]" UpdateCommand="UPDATE [Order] SET [CustomerUserName] = @CustomerUserName, [OrderDate] = @OrderDate, [title] = @title, [theatre] = @theatre, [cinema] = @cinema, [sessiondate] = @sessiondate, [sessiontime] = @sessiontime, [numadult] = @numadult, [numchild] = @numchild, [numsenior] = @numsenior, [numstudent] = @numstudent, [numpensioner] = @numpensioner, [totalticket] = @totalticket, [AmountPaid] = @AmountPaid, [tickettype] = @tickettype, [creditcardtype] = @creditcardtype, [namecard] = @namecard, [cardnumber] = @cardnumber, [expiredate] = @expiredate WHERE [OrderId] = @OrderId" >

        <InsertParameters>
            <asp:Parameter Name="CustomerUserName" Type="String"  />
            <asp:Parameter DbType="Date" Name="OrderDate"  />
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="theatre" Type="String" />
            <asp:Parameter Name="cinema" Type="String" />
            <asp:Parameter DbType="Date" Name="sessiondate"  />
            <asp:Parameter DbType="Time" Name="sessiontime" />
            <asp:Parameter Name="numadult" Type="Int16" />
            <asp:Parameter Name="numchild" Type="Int16" />
            <asp:Parameter Name="numsenior" Type="Int16" />
            <asp:Parameter Name="numstudent" Type="Int16" />
            <asp:Parameter Name="numpensioner" Type="Int16" />
            <asp:Parameter Name="totalticket" Type="String" />
            <asp:Parameter Name="AmountPaid" Type="String" />
            <asp:Parameter Name="tickettype" Type="String" />
            <asp:Parameter Name="creditcardtype" Type="String" />
            <asp:Parameter Name="namecard" Type="String" />
            <asp:Parameter Name="cardnumber" Type="String" />
            <asp:Parameter Name="expiredate" Type="String" />
            
        </InsertParameters>
    </asp:SqlDataSource>
         <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [datesession] WHERE [sessionid] = @sessionid AND [date] = @date" 
        InsertCommand="INSERT INTO [datesession] ([ticketsold], [sessionid], [date]) VALUES (@ticketsold, @sessionid, @date)" 
        SelectCommand="SELECT [ticketsold], [sessionid], [date] FROM [datesession] WHERE (([sessionid] = @sessionid) AND ([movieid] = @movieid))" 
        UpdateCommand="UPDATE [datesession] SET [ticketsold] = @ticketsold WHERE [sessionid] = @sessionid AND [date] = @date">

             <UpdateParameters>
                 <asp:Parameter Name="ticketsold" Type="String" />
                 <asp:Parameter Name="sessionid" Type="String" />
                 <asp:Parameter DbType="Date" Name="date" />
             </UpdateParameters>
             <InsertParameters>
                 <asp:Parameter Name="ticketsold" Type="String" />
                 <asp:Parameter Name="sessionid" Type="String" />
                 <asp:Parameter DbType="Date" Name="date" />
             </InsertParameters>
    </asp:SqlDataSource>     
    
  <asp:Button ID="Button7" Text="Confirm"  CommandName="NextView" OnClick="update"     runat="server" />  
</asp:View>
     <asp:View ID="view4" runat="server">
         <asp:GridView ID="GridView4"  DataSourceID="SqlDataSource4" runat="server">
         </asp:GridView> 
         <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
             ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
             SelectCommand="SELECT * FROM [Order]"></asp:SqlDataSource>

     
     </asp:View>                      
 </asp:MultiView>



	

    </form>
  <table width="100" cellpadding="15" ><tr><td>Copyright@2012 MovieTix</td><td><asp:HyperLink ID="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Session</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Movies</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink11"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Cinemas</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Log In</asp:HyperLink></td></tr></table>
</body>
</html>
